package com.csun.dsms.service.impl;

import com.csun.dsms.comment.core.support.BaseService;
import com.csun.dsms.mapper.HgUserMapper;
import com.csun.dsms.mapper.YcAlertMapper;
import com.csun.dsms.model.domain.YcAlert;
import com.csun.dsms.model.dto.yc.YcDeviceQueryDto;
import com.csun.dsms.model.huang.HgQueryDto;
import com.csun.dsms.model.huang.HgUser;
import com.csun.dsms.service.HgUserService;
import com.csun.dsms.service.YcAlertService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class HgUserServiceImpl extends BaseService<HgUser> implements HgUserService {

    @Resource
    private HgUserMapper hgUserMapper;

    @Override
    public Integer addHgUser(HgUser hgUser) {
        return hgUserMapper.insert(hgUser);
    }

    @Override
    public List<HgUser> queryList(HgQueryDto hgQueryDto) {
        return hgUserMapper.queryListWithPage(hgQueryDto);
    }

    @Override
    public Integer editUser(HgUser hgUser) {
        return hgUserMapper.updateByPrimaryKey(hgUser);
    }

    @Override
    public HgUser selectByPhone(String mobilePhone) {
        HgQueryDto hgQueryDto = new HgQueryDto();
        hgQueryDto.setPhone(mobilePhone);
        HgUser hgUser = hgUserMapper.selectUserByPhone(hgQueryDto);
        if (hgUser!=null){
            return hgUser;
        }
        return null;
    }

}
